<?php

namespace Kollway\CodeGenerator\Commands;

use Kollway\CodeGenerator\Generators\GeneratorTrait;
use Kollway\CodeGenerator\Generators\ListDialogGenerator;

class CreateListDialogCommand extends BaseCommand
{
    use GeneratorTrait;

    protected $signature = 'cld {--table=} {--file=}';

    protected $description = '创建列表对话框';

    /** @throws \Throwable */
    public function handle()
    {
        $this->getTableAndOption($table, $option);

        $generator = new ListDialogGenerator($table, $option);
        $generator->generateDialogString();
        $generator->writeToFile();
    }
}